package yxy.apple.database.db;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name = "user")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class user implements Serializable {
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id")
	private int id;
	@Column(name = "name")
	private String name;

	@Transient
	private AtomicBoolean save = new AtomicBoolean(false);

	public user() {
		save.set(true);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
		save.set(true);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
		save.set(true);
	}

	public boolean isSave() {
		return save.get();
	}

	public void setSave(boolean b) {
		save.set(b);
	}
}
